<template>
  <div class="enable">
    <el-dialog :visible.sync="visible">
      <div class="enable-page panelWrap flex flexdc">
        <div class="enable-main m-t-25">
          <el-steps :space="200" :active="active" align-center finish-status="success">
            <el-step v-for="item in sysList" :key="item.id" :title="item.name" />
          </el-steps>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>

import { showNotice } from '@/utils/toolclass'
import { userReview } from '@/api/baseInfo/authority/user'

export default {
  name: 'Enable',
  components: {},
  props: {
    isEdit: {
      type: Boolean
    },
    value: {
      type: Boolean,
      default: false
    },
    data: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      visible: false,
      sysList: [
        {
          id: 0,
          name: '业务平台'
        },
        {
          id: 1,
          name: '凌波平台'
        },
        {
          id: 2,
          name: '权限平台'
        }
      ],
      active: 0,
      form: { ...this.data }
    }
  },
  computed: {},
  watch: {
    visible(v) {
      this.$emit('input', v)
    },
    value(v) {
      this.visible = v
    },
    data(v) {
      userReview(v.id).then(res => {
        // console.log(res)
        if (res.code === '000000') {
          this.active = 3
          this.visible = false
          this.$emit('update', res)
          this.$emit('handleRefresh')
          showNotice('success', '提示', '启用成功')
        } else {
          showNotice('error', '提示', '启用失败')
          setTimeout(() => {
            this.visible = false
          }, 500)
        }
      })
    }
  },
  mounted() {},
  methods: {}
}
</script>

<style lang="scss">
@import '@/styles/public.scss';
.enable-page {
  width: 600px;
  height: 100px;
  margin-top: 340px;
  background: #ffffff;
  .enable-main {
    flex: 1;
  }
}
</style>
